const Koa = require('koa')
//单独创建router的实例
const Router = require('koa-router')
const app = new Koa()
const router = new Router()
const config = require('./config/default.js')
const chalk = require('chalk')
const _open = require('opener')
const _log = console.log

require("./config/config")(app)
require("./config/route")(app)

app.listen(config.port, err => {
  if (err) throw err
  _open(`http://127.0.0.1:${config.port}`)
  _log(
    chalk.green("koa_ms is running on") +
    chalk.blue(` http://127.0.0.1:${config.port}`) +
    chalk.green(" click it to visit!")
  )
})
